home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 08.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  5.1 KB  |  255 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Type = strip(line)
  22. line = readln(TempFile)
  23. Type2 = strip(line)
  24. call close (TempFile)
  25. j=0
  26. TFrames = Frames
  27. if Field = 1 then TFrames = Frames*2
  28. do i = 1 to Frames
  29.     call open TempFile,"RAM:VFXNums",W
  30.     call writeln TempFile,right(i,5,'0')
  31.     call writeln TempFile,right(Frames,5,'0')
  32.     call close TempFile
  33.     f=0
  34.     Redraw Off
  35.     FieldSet = 0
  36.     if Padding ~= -1 & i = 1 then call PadIt(1)
  37.     call LoadB()
  38.     call LoadA()
  39.     j = j+ 1
  40.     call DoIt()
  41.     Redraw On
  42.     call SaveIt()
  43.         if Field = 1 then do
  44.             Redraw Off
  45.             FieldSet = 1
  46.             call LoadB()
  47.             call LoadA()
  48.             j = j + 1
  49.             call DoIt()
  50.             Redraw On
  51.             call SaveIt()
  52.             end 
  53.     if Padding ~= -1 & i = Frames then call PadIt(2)
  54.     end
  55.     if SaveType = 0 then do
  56.         if Padding = -1 then
  57.             call MakeIcon(SaveName,(Frames-10))
  58.         else
  59.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  60.         end
  61.     Undo On
  62. exit
  63.  
  64.  
  65. PadIt:
  66. arg PadNum
  67.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  68.         Undo On
  69.         exit
  70.         end
  71.          if PadNum = 1 then do
  72.        if IAType = 0 then do
  73.         do Pad = Padding to 1 by -1
  74.             LoadBuffer PicAName Force StartA-(Pad-1)
  75.             call Switcher(TOSW)
  76.             call Switcher(MDV1)
  77.             Render Go
  78.                 call RecordAdd(SaveName,2,6,Compression)
  79.             end
  80.         end
  81.        if IAType = 1 then do
  82.         LoadBuffer PicAName Force 1
  83.         call Switcher(TOSW)
  84.         call Switcher(MDV1)
  85.         Render Go
  86.             call RecordAdd(SaveName,2*Padding,6,Compression)
  87.         end
  88.        if IAType = 2 then do
  89.         LoadBuffer PicAName Force
  90.         call Switcher(TOSW)
  91.         call Switcher(MDV1)
  92.         Render Go
  93.             call RecordAdd(SaveName,2*Padding,6,Compression)
  94.         end
  95.        if IAType = 3 then do
  96.         do Pad = Padding to 1 by -1
  97.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  98.             call Switcher(TOSW)
  99.             call Switcher(MDV1)
  100.             Render Go
  101.                 call RecordAdd(SaveName,2,6,Compression)
  102.             end
  103.         end
  104.     end 
  105.     else do
  106.        if IBType = 0 then do
  107.         do Pad = 1 to Padding
  108.             LoadBuffer PicBName Force StartB+Pad+Frames
  109.             call Switcher(TOSW)
  110.             call Switcher(MDV1)
  111.             Render Go
  112.                 call RecordAdd(SaveName,2,6,Compression)
  113.             end
  114.         end
  115.        if IBType = 1 then do
  116.         LoadBuffer PicBName Force 1
  117.         call Switcher(TOSW)
  118.         call Switcher(MDV1)
  119.         Render Go
  120.             call RecordAdd(SaveName,2*Padding,6,Compression)
  121.         end
  122.        if IBType = 2 then do
  123.         LoadBuffer PicBName Force
  124.         call Switcher(TOSW)
  125.         call Switcher(MDV1)
  126.         Render Go
  127.             call RecordAdd(SaveName,2*Padding,6,Compression)
  128.         end
  129.        if IBType = 3 then do
  130.         do Pad = 1 to Padding
  131.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  132.             call Switcher(TOSW)
  133.             call Switcher(MDV1)
  134.             Render Go
  135.                 call RecordAdd(SaveName,2,6,Compression)
  136.             end
  137.         end
  138.     end
  139. return
  140.  
  141.  
  142. LoadA:
  143.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  144.         Undo On
  145.         exit
  146.         end
  147.     if j = TFrames then return
  148.     if IAType = 0 then do
  149.         LoadBuffer PicAName Force i+StartA
  150.         end
  151.     if IAType = 1 then do
  152.         LoadBuffer PicAName Force 1
  153.         end
  154.     if IAType = 2 then do
  155.         LoadBuffer PicAName Force
  156.         end
  157.     if IAType = 3 then do
  158.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  159.         end
  160.  
  161. return
  162.  
  163. LoadB:
  164.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  165.         Undo On
  166.         exit
  167.         end
  168.     if j = 1 then return
  169.     if j < TFrames/2 then return
  170.     if IBType = 0 then do
  171.         LoadBuffer PicBName Force i+StartB
  172.         end
  173.     if IBType = 1 then do
  174.         LoadBuffer PicBName Force 1
  175.         end
  176.     if IBType = 2 then do
  177.         LoadBuffer PicBName Force
  178.         end
  179.     if IBType = 3 then do
  180.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  181.         end
  182.     Swap
  183. return
  184.  
  185.  
  186. DoIt:
  187.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  188.         Undo On
  189.         exit
  190.         end
  191.     if j = TFrames then do
  192.         Swap
  193.         return
  194.         end
  195.     if j = 1 then do
  196.         GetMain
  197.         parse var result Name Width Height Blah
  198.         return
  199.         end
  200.  
  201.     ByNum = 360
  202.     NewNum2 = trunc(((j-1)*ByNum)/(TFrames-1))
  203.     if Type = 1 then NewNum2 = -NewNum2
  204.     Hook Rotate NewNum2 0 0 0 Width/2 Height/2 Height/2 0 0 AntiAlias Aspect
  205.  
  206.     if j > (TFrames/2) then do
  207.         ByNum = 180
  208.         PerNum = trunc(((j)*ByNum)/((TFrames/2))-180)
  209.         if Type2 = 1 then PerNum = -PerNum
  210.         Hook Perspective '0' '0' '0' '0' PerNum '0' '0' '0' 0 -1 -1 0 SwapScale AntiAlias
  211.         end
  212.  
  213. return
  214.  
  215. SaveIt:
  216.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  217.         Undo On
  218.         exit
  219.         end
  220.     if SaveType = 0 then do
  221.         call Switcher(TOSW)
  222.         call Switcher(MDV1)
  223.  
  224.         Render Go
  225.         if Field = 1 then
  226.                 call RecordAdd(SaveName,1,6,Compression)
  227.         else
  228.                 call RecordAdd(SaveName,2,6,Compression)
  229.         end
  230.  
  231.     if SaveType = 1 then do
  232.         if Field = 1 then do
  233.             f= f + 1
  234.             if f = 1 then
  235.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  236.             if f = 2 then do
  237.                 GetMain
  238.                 parse var result Name Width Height Blah
  239.                 Scale Width Height/2
  240.                 Swap
  241.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  242.                 Scale Width Height/2
  243.                 Hook Interlace
  244.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  245.                 f = 0
  246.                 end
  247.             end
  248.         else do
  249.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  250.             end    
  251.         end
  252. return
  253.  
  254.  
  255.